package com.mingshine.cloud.listener;

import com.mingshine.cloud.config.QueueConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class DeviceMinaListener {

    public static final Logger logger = LoggerFactory.getLogger(DeviceMinaListener.class);

    /****
     * 监听队列，一旦此队列出现数据，则自动消费此队列的数据 ，广播机制的队列名称【QueueConfig.QUEUE_FANOUT_NAME】
     * @param message
     * @throws Exception
     */
    @RabbitListener(queues = {QueueConfig.QUEUE_UPDATE_DEVICE_WORKINFO}, containerFactory = "rabbitListenerContainerFactory")
    public void handleMessage(String message) throws Exception {
        // 处理消息
        logger.info("广播机制队列：{}, 第一个消费者： 接收到消息如下：{} ", QueueConfig.QUEUE_UPDATE_DEVICE_WORKINFO, message);
    }

}